import request from './request'

export const getProducts = (params?: any) =>
  request.get('/products', { 
    params: {
      ...params,
      status: 'active' // 只获取active状态的商品
    }
  })

export const getProductDetail = (id: number) =>
  request.get(`/products/${id}`)

// 添加缺失的导出
export const addToCart = (data: { product_id: number; quantity: number }) =>
  request.post('/cart/items', data)